<template>
	<view>
		<view class="box">
			<view class="top">
				<view>
					{{ren[0].patients_name}}
					<text class="tag">本人</text>
				</view>
				<p class="pp">622*******0909</p>
			</view>

			<view class="right " @click="toggle('bottom')">
				<view class="myimg">
					<image src="/static/images/切换.png"></image>
				</view><text>切换就诊人</text>
			</view>
			<view>
				<!-- 普通弹窗 -->
				<uni-popup ref="popup" background-color="#fff" @change="change">
					<view class="popup-content" :class="{ 'popup-height': type === 'left' || type === 'right' }">
						<view class="box"  v-for="v in ren2">
							<view class="top">
								<view>{{v.patients_name}}
									<text class="tag" v-if="v.patients_department==1">本人</text>
									<text class="tag" v-else-if="v.patients_department==2">父母</text>

								</view>
								<p class="pp">{{v.patients_id_number}}</p>
							</view>


							<view class="right"><text>默认就诊人</text></view>
						</view>
					</view>
				</uni-popup>
			</view>
		</view>
		<view class="p">
			<p class="myp">科室-保健科</p>
			<p>选择预约时间</p>
		</view>

	</view>
	<view class="time">
		<makeselectRiqi></makeselectRiqi>
	</view>

	<view class="p1">
		<p class="myp">上午号源</p>
	</view>

	<view class="btn clear" @click="tiaozhun">
		<view v-for="item in timem">{{item}}</view>
	</view>
	<view class="p1">
		<p class="myp">下午号源</p>
	</view>

	<view class="btn clear">
		<view v-for="item in timee">{{item}}</view>
	</view>

</template>

<script>
	import makeselectRiqi from '@/components/bookingReg/makeselectRiqi/makeselectRiqi.vue'
	export default {
		data() {

			return {
				timem: [
					"9.00-9.30",
					"9.30-10.00",
					"10.00-10.30",
					"10.30-11.00",
					"11.00-11.30",
					"11.30-12.00"

				],
				timee: [
					"13.30-14.00",
					"14.00-14.30",
					"14.30-15.00",
					"15.00-15.30",
					"15.30-16.00",
					"16.00-16.30",
					"16.30-17.00",
					"17.00-17.30",
					"17.30-18.00"

				],
				ren: [],
				binData: {},
				ren2:[]
			}
		},
		components: {
			makeselectRiqi
		},

		methods: {
			tiaozhun() {
				let obj1 =this.ren
				uni.setStorageSync('binData1',obj1);
				uni.navigateTo({
					url: "/pages/home/hesuandetect/confirmation/confirmation"
				})
				
			},
			change(e) {
				console.log('当前模式：' + e.type + ',状态：' + e.show);
			},
			toggle(type) {

				// open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
				this.$refs.popup.open(type)
			},
			getall() {
				uni.request({
					url: "http://localhost:3000/selecttable",
					data:{id:1},
					success: (res) => {
						console.log(res);
						this.binData = res.data.data

					}
				})

			},
		},
		onLoad(options) {
			const list = uni.getStorageSync('binData');
			list.forEach((item) => {
				if (options.id == item.patients_id) {
					this.ren.push(item)
				}else{
					this.ren2.push(item)
				}
			})
			console.log(this.ren)
			this.getall()
		}
	}
</script>

<style lang="scss">
	.clear::after {
		content: '';
		display: block;
		clear: both;
	}

	.box {
		display: flex;
		justify-content: space-between;
		padding-top: 30rpx;
		background-color: #f5f9ff;
		width: 700rpx;
		height: 150rpx;
		margin-left: 20rpx;
		margin-bottom: 25rpx;
		margin-top: 25rpx;

		.right {
			display: flex;

			// flex-direction: column;
			text {
				font-size: 12px;
				color: #939598;
				padding-right: 25rpx;
				box-sizing: border-box;
			}

			.myimg {
				image {
					width: 30rpx;
					height: 30rpx;
					z-index: 2;
				}

				width: 40rpx;
				height: 40rpx;
				border-radius: 20rpx;

			}
		}

		.tag {
			display: inline-block;
			width: 80rpx;
			height: 35rpx;
			background: #e2edfe;
			color: #4f9aff;
			text-align: center;
			border-radius: 20rpx;
			font-size: 20rpx;
		}
	}



	.top {
		padding-left: 25rpx;
		box-sizing: border-box;

		.pp {
			margin-top: 20rpx;
			font-size: 12px;
			color: #939598;
		}
	}

	.tit {
		margin-left: 25rpx;
	}

	.p {
		width: 700rpx;
		height: 150rpx;
		margin-left: 20rpx;
		margin-bottom: 25rpx;
		margin-top: 25rpx;
		line-height: 80rpx;
	}

	.myp {
		color: #b8b9b9;
		font-size: 30rpx;
	}

	.time {
		padding-top: 30rpx;
		// border:1px solid #d2d3d3 ;
		width: 700rpx;
		height: 150rpx;
		margin-left: 20rpx;
		margin-bottom: 25rpx;
		margin-top: 25rpx;
	}

	.p1 {
		width: 700rpx;
		height: 50rpx;
		margin-left: 20rpx;
		margin-bottom: 25rpx;
		margin-top: 25rpx;
		line-height: 80rpx;
	}

	.btn {
		margin-bottom: 30rpx;

		view {
			float: left;
			width: 230rpx;
			// height: 50rpx;
			margin: 15rpx 10rpx;
			border-radius: 25rpx;
			// background-color: #f2f2f2;
			// color: #b8b9b9 ;
			background-color: #eff6ff;
			color: #4f9aff;
			font-size: 30rpx;
			padding: 10rpx;
			box-sizing: border-box;
			text-align: center;
		}

		// .blue{
		// 	background-color: #eff6ff;
		// 	color: #4f9aff;
		// }
	}

	.popup-content {
		// @include flex;
		// height: 200rpx;
		box-sizing: border-box;
		display: flex;
		flex-direction: column;

		align-items: center;
		justify-content: center;
		padding-right: 15px;

		background-color: #fff;
	}

	.text {
		font-size: 12px;
		color: #333;
	}
</style>
